﻿package com.hnev.likai;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class Welcome extends JFrame{
	private JButton button;
	private JLabel label;
	
	public  Welcome(){
		button = new JButton("进入系统");
		label = new JLabel("\t欢迎进入\n水果超市管理系统");
		setLayout(new BorderLayout());
		
		//嵌套使Label居中
		JPanel panel = new JPanel();
		panel.setLayout(null);
		label.setBounds(150, 125, 400, 80); 
		panel.add(label);
		//设置布局
		add(panel,BorderLayout.CENTER);
		add(button,BorderLayout.SOUTH);
		//设置属性
		setLocation(800, 600);
		setSize(550, 400);
		setVisible(true);
		/*
		 * 设置按键属性
		 * dispose()关闭当前JFrame
		 * */
		
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				new Login();
				dispose();
			}
		});
	}
}
